package com.nbsaas.boot.shop.rest.convert;

import com.nbsaas.boot.shop.data.entity.ShopCheckIn;
import com.nbsaas.boot.shop.api.domain.response.ShopCheckInResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* -实体对象转化成响应对象
*/

public class ShopCheckInResponseConvert  implements Converter<ShopCheckInResponse,ShopCheckIn> {

    @Override
    public ShopCheckInResponse convert(ShopCheckIn source) {
        ShopCheckInResponse  result = new  ShopCheckInResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getShop()!=null){
                        result.setShop(source.getShop().getId());
                    }

                    try {
                        if(source.getShop()!=null){
                            result.setShopName(source.getShop().getName());
                        }
                    } catch (Exception ignored) { }

                    if(source.getUser()!=null){
                        result.setUser(source.getUser().getId());
                    }
        return result;
    }

}

